﻿using FU.Capstones.IMS.Services.Common.Respondents;

namespace FU.Capstones.IMS.Services.Common
{
    public interface IDataAccessObject<T>
    {
        /// <summary>
        /// This method aims to get all records of a table from database
        /// </summary>
        /// <returns>
        /// An Feedback object contains all those records
        /// </returns>
        CollectionFeedback<T> GetCollection(bool isShowAll);

        /// <summary>
        /// This method aims to get all records of a table from database
        /// </summary>
        /// <returns>
        /// An Feedback object contains all those records
        /// </returns>
        CollectionFeedback<T> GetCollectionType(bool isShowAll);

        /// <summary>
        /// This method aims to get detailed information of an object based on its ID.
        /// </summary>
        /// <param name="objectID">
        /// The ID of the desired object
        /// </param>
        /// <returns>
        /// A Feedback object containing a detailed object
        /// </returns>
        SingleFeedback<T> GetSingle(int objectID);

        /// <summary>
        /// This method aims to insert a new record into database
        /// </summary>
        /// <param name="data">
        /// The object to be inserted
        /// </param>
        /// <returns>
        /// A Feedback object containing information about 
        ///    - inserting result and 
        ///    - the ID of new object if success or -1 otherwise
        /// </returns>
        SingleFeedback<int> Insert(T data);

        /// <summary>
        /// This method aims to update an existing record in database
        /// </summary>
        /// <param name="data">
        /// The object to be updated
        /// </param>
        /// <returns>
        /// A Feedback object containing updating result
        /// </returns>
        Feedback Update(T data);

        /// <summary>
        /// This method aims to delete an existing record in database
        /// </summary>
        /// <param name="objID">
        /// The ID of record to be deleted
        /// </param>
        /// <returns>
        /// A Feedback object containing deleting result
        /// </returns>
        Feedback Delete(int objID);

        /// <summary>
        /// This method aims to find out specific record(s) in the database based on the input criteria.
        /// </summary>
        /// <param name="criteria">
        /// The object contains the searching criteria.
        /// </param>
        /// <returns>
        /// A Feedback object containing searching result
        /// </returns>
        CollectionFeedback<T> Search(T criteria);

        /// <summary>
        /// This method aims to undo an deleted record in database
        /// </summary>
        /// <param name="objID">
        /// The ID of record to be undeleted
        /// </param>
        /// <returns>
        /// A Feedback object containing result
        /// </returns>
        Feedback UndoDelete(int objID);
    }
}
